# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=darkmysqli
pkgver=1.6
pkgrel=5
pkgdesc='Multi-Purpose MySQL Injection Tool'
arch=('any')
url='https://github.com/BlackArch/darkmysqli'
license=('custom:unknown')
depends=('python2')
groups=('blackarch' 'blackarch-exploitation' 'blackarch-webapp')
source=("https://github.com/BlackArch/darkmysqli/raw/master/darkmysqli${pkgver//./}.tar.gz")
sha512sums=('5a835aeffb8a06af9152db338a0a900d8ffe1e7c1654fed6706d811034ded02efc6f09a472df2981663730757a14e50c7fc589868c795b44a1252b9275159576')

prepare() {
  cd darkmysqli16

  patch -p0 < darkmysqli.patch

  sed -i '1s|bin/python|bin/env python2|' *.py
}

package() {
  install -Dm 755 "$srcdir/darkmysqli16/darkmysqli16.py" \
    "$pkgdir/usr/bin/$pkgname"

  install -Dm 644 "$srcdir/darkmysqli16/columnsfuzz.txt" \
    "$pkgdir/usr/share/$pkgname/columnsfuzz.txt"

  install -Dm 644 "$srcdir/darkmysqli16/loadfilefuzz.txt" \
    "$pkgdir/usr/share/$pkgname/loadfilefuzz.txt"

  install -Dm 644 "$srcdir/darkmysqli16/proxies.txt" \
    "$pkgdir/usr/share/$pkgname/proxies.txt"

  install -Dm 644 "$srcdir/darkmysqli16/tablesfuzz.txt" \
    "$pkgdir/usr/share/$pkgname/tablesfuzz.txt"

  install -Dm 644 "$srcdir/darkmysqli16/wordlist.txt" \
    "$pkgdir/usr/share/$pkgname/wordlist.txt"
}

